const debug = import.meta.env.MODE !== 'production'

export default ({ mock, setup }: { mock?: boolean; setup: () => void }) => {
    if (mock !== false && debug) setup()
}

export const successResponseWrap = (data: unknown) => {
    return {
        data,
        message: '成功',
        code: 0
    }
}

export const failResponseWrap = (message = '失败', code = 400) => {
    return {
        data: [],
        message,
        code
    }
}
